package rip910;

/**
 * Descreve um comando condicional ('if')
 *
 */
public class IfStat extends StatOp {
	
	private Expression condition; 
	private StatOp thenPart;
	private StatOp elsePart;
	
	/** getters **/
	public Expression getCondition() { return condition; }
	public StatOp getThenPart() { return thenPart; }
	public StatOp getElsePart() { return elsePart; }
	
	/** setters **/
	public void setCondition(Expression cond) { condition = cond; }
	public void setThenPart(StatOp tp) { thenPart = tp; }
	public void setElsePart(StatOp ep) { elsePart = ep; }
	
	/**
	 * Construtor
	 * @param cond
	 * @param then
	 * @param els
	 */
	public IfStat(Expression cond, StatOp then, StatOp els){
		condition = cond;
		thenPart = then;
		elsePart = els;
	}


	@Override
	public Object accept(Visitor v) {
		return v.visit(this);
	}


}
